<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/js/kindeditor-all-min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/zh_CN.js"></script>
<link rel="stylesheet" href="__PUBLIC__/css/kindeditor.css" type="text/css" />
<script type="text/javascript">
	<if condition="C('ismobile') neq 1">
		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="content"]', {
				uploadJson:'__APP__/index.php/File/editor/',
				allowFileManager : true,
				loadStyleMode : false,
				fileManagerJson: "__APP__/index.php/File/manager/"
			});
		});
	</if>
</script>
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header">
		<h4>修改 文档下载</h4>
	</div>
	<div class="row">
		<div class="span12">
			<include file="Public:alert" />
			<form action="__APP__/index.php/Downloads/edit/" method="post" enctype="multipart/form-data">
			   <input type="hidden" name="down_id" id="down_id" value="{$vo.down_id}" />
				<input  type="hidden" name="role_id" value="{$Think.session.role_id}"/>
				<table class="table" border="0" cellspacing="1" cellpadding="0">
					<thead>
						<tr>
							<td colspan="2"><input name="submit" class="btn btn-primary" type="submit" value="保存"/>&nbsp; <input class="btn btn-primary" name="submit" type="submit" value="保存 & 新增"/> &nbsp;<input class="btn" type="button" onclick="javascript:history.go(-1)" value="返回"/></td>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="2"><input class="btn btn-primary"  name="submit" type="submit" value="保存"/> &nbsp;<input class="btn btn-primary" type="submit" value="保存 & 新增"/>&nbsp; <input class="btn" type="button" onclick="javascript:history.go(-1)" value="返回"/></td>
						</tr>
					</tfoot>
					<tbody>
						
						<tr>
							<td class="tdleft">文档下载标题</td>
							<td><input class="span3" type="text" name="name" id="name" size="80" placeholder="请输入标题" value="{$vo.name}"></td>
						</tr>
						<tr>
						<td class="tdleft">下载分类</td>
							<td>
							<select name="cid" id="cid">
							  <volist  name="category_list" id="vvo">
							  <option value="{$vvo.id}" <?php if($vvo['id']==$vo['category_id'])echo " selected";?>>{$vvo.name}</option>
							  </volist>
							</select>
							</td>
						</tr>
						<tr>
							<td class="tdleft">用户权限组</td>
							<td>
								<select name="groups">
									<option value="1"<?php if($vo['groups']==1)echo " selected";?>>所有用户可下载</option>
									<option value="2"<?php if($vo['groups']==2)echo " selected";?>>VIP用户可下载</option>
									<option value="3"<?php if($vo['groups']==3)echo " selected";?>>核心用户可下载</option>
									<option value="4"<?php if($vo['groups']==4)echo " selected";?>>内部员工可下载</option>
								</select>
							</td>
						</tr>
						<tr>
							<td class="tdleft">文档说明</td>
							<td>
								<textarea name="content" id="content" style="width: 800px; height: 350px;">{$vo.content}</textarea>
							</td>
						</tr>
						<tr>
							<td class="tdleft">排序</td>
							<td><input class="span3" type="text" name="sort" id="sort" placeholder="排序" size="5" value="{$vo.sort}"></td>
						</tr>
						<tr>
							<td class="tdleft">上传文档</td>
							<td>
							 <?php if(!empty($vo)){?>
							 <a  href="/Public/Uploads/<?php echo $vo['savename'];?>" >下载  <?php echo $vo['origin_name'];?></a>
							 <?php }?>
							 <input type="file" name="downfile" />
							</td>
						</tr>
					</tbody>
				</table>
			</form>

		</div>
	</div>
</div>
<script type="text/javascript">
	<if condition="C('ismobile') eq 1">
		width=$('.container').width() * 0.9;
		$("#content").css({
			width : width
		});
	</if>
	$("input[name='submit']").click(function(){			
		if($("#name").val() == null || $("#name").val() == ""){
			alert('名称不能为空');
			return false;
		}
	})
	$(".fa-laptop").parent().parent().addClass("active");
</script>
<include file="Public:footer" />